<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery-3.4.1.js"></script>
</head>
<body>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <button>按钮</button>
    <script>
        $('button').click(function(){
            //$('div').css('background-color','red');
            $('div').eq(0).css('background-color','red');
            $('div').eq(1).css('background-color','green');
            $('div').eq(2).css('background-color','blue');
        })
    </script>
</body>
</html>